package day06;
import  java.util.Scanner;
import  java.util.Random;
/**
 * 需求:猜数字小游戏
 * 训练目标:while(true)自造死循环+break
 */
public class Guessing {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        Random rd = new Random();
        int sum = rd.nextInt(100);
        System.out.println(sum);


        while(true){
            System.out.println("猜吧");
            int guess = sc.nextInt();
            if (guess<sum){
                System.out.println("猜小了");
            } else if (guess>sum) {
                System.out.println("猜大了");
            }
            else {
                System.out.println("恭喜你猜对了");
                break;
            }
        }
    }
}
